import time

from appium import webdriver
from appium.webdriver.common.mobileby import MobileBy
from appium.webdriver.common.touch_action import TouchAction

dict_caps = {}
dict_caps['platformName'] = 'Android'
dict_caps['platformVersion'] = '7.1.2'
dict_caps['deviceName'] = 'x1q'
dict_caps['appPackage'] = 'com.lingyue.zebraloan'
dict_caps['appActivity'] = 'com.lingyue.banana.activities.BananaLaunchActivity'

#初始化驱动
driver = webdriver.Remote('http://localhost:4723/wd/hub',dict_caps)
# 设置隐式等待
driver.implicitly_wait(15)
# 通过tap点击定位同意按钮  x 436 y 1001；点击的动作是瞬发的，有可能页面没加载出来，点击就先出去了
time.sleep(2)
TouchAction(driver).tap(x = 436,y = 1001).perform()
# 等待主页面加载
time.sleep(5)
#点击用户故事  x 575 y 997
TouchAction(driver).tap(x = 575,y = 997).perform()
# 等待页面加载
time.sleep(3)
# 滑动页面
"""
开始的位置：x=535、y=1564
结束的位置：x=541，y=363
"""
TouchAction(driver).press(x=535,y=1564).move_to(x=541,y=363).release().perform()
time.sleep(5) # 看看结果








